<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  <html xmlns="http://www.w3.org/1999/xhtml">
		<head>
			<!-- template designed by Marco Von Ballmoos  -->
			<title>File Source for sample.php</title>
			<link rel="stylesheet" href="../media/stylesheet.css" />
											</head>
		<body>
						<h1>Source for file sample.php</h1>
<p>Documentation is available at <a href="../BankLink/_libsPub---BankLink---sample.php.html">sample.php</a></p>
<div class="src-code">
<div class="src-code"><ol><li><div class="src-line"><a name="a1"></a><span class="src-php">&lt;?php&nbsp;</span></div></li>
<li><div class="src-line"><a name="a2"></a><span class="src-doc">/**</span></div></li>
<li><div class="src-line"><a name="a3"></a><span class="src-doc">&nbsp;*&nbsp;Using:</span></div></li>
<li><div class="src-line"><a name="a4"></a><span class="src-doc">&nbsp;*&nbsp;1)&nbsp;USING:&nbsp;create&nbsp;configuration&nbsp;file&nbsp;to&nbsp;DOM_CONF_DIR_PATH/banklink.conf.php&nbsp;(See&nbsp;sample-conf.php)</span></div></li>
<li><div class="src-line"><a name="a5"></a><span class="src-doc">&nbsp;*&nbsp;2)&nbsp;Call&nbsp;BankLog::getTable()-&gt;update()</span></div></li>
<li><div class="src-line"><a name="a6"></a><span class="src-doc">&nbsp;*</span></div></li>
<li><div class="src-line"><a name="a7"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@package</span><span class="src-doc">&nbsp;BankLink</span></div></li>
<li><div class="src-line"><a name="a8"></a><span class="src-doc">&nbsp;*&nbsp;</span><span class="src-doc-coretag">@author</span><span class="src-doc">&nbsp;Oliver&nbsp;Leisalu</span></div></li>
<li><div class="src-line"><a name="a9"></a><span class="src-doc">&nbsp;*/</span></div></li>
<li><div class="src-line"><a name="a10"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a11"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a12"></a><span class="src-comm">//&nbsp;Start&nbsp;Dom&nbsp;framework&nbsp;and&nbsp;connect&nbsp;to&nbsp;database</span></div></li>
<li><div class="src-line"><a name="a13"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a14"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a15"></a><span class="src-comm">//&nbsp;direct&nbsp;user&nbsp;to&nbsp;bank</span></div></li>
<li><div class="src-line"><a name="a16"></a><span class="src-key">if</span><span class="src-sym">(&nbsp;</span><span class="src-var">$_POST</span><span class="src-sym">[</span><span class="src-str">'bank'</span><span class="src-sym">]&nbsp;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a17"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a18"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;UID,&nbsp;price,&nbsp;description,&nbsp;bank[swed|seb|sampo|nordea|estcard|dummy|ipx]</span></div></li>
<li><div class="src-line"><a name="a19"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$payment&nbsp;</span>=&nbsp;<span class="src-key">new&nbsp;</span><span class="src-id"><a href="../BankLink/BankPayment.html">BankPayment</a></span><span class="src-sym">(&nbsp;</span><span class="src-num">100</span><span class="src-sym">,&nbsp;</span><span class="src-var">$_POST</span><span class="src-sym">[</span><span class="src-str">'price'</span><span class="src-sym">]</span><span class="src-sym">,&nbsp;</span><span class="src-str">'Test&nbsp;buy'</span><span class="src-sym">,&nbsp;</span><span class="src-var">$_POST</span><span class="src-sym">[</span><span class="src-str">'bank'</span><span class="src-sym">]&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a20"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;You&nbsp;can&nbsp;access&nbsp;this&nbsp;data&nbsp;same&nbsp;way&nbsp;when&nbsp;user&nbsp;comes&nbsp;back&nbsp;from&nbsp;bank.</span></div></li>
<li><div class="src-line"><a name="a21"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$payment</span><span class="src-sym">-&gt;</span><span class="src-id">userData&nbsp;</span>=&nbsp;<span class="src-key">array</span><span class="src-sym">(</span><span class="src-str">'someKey'&nbsp;</span>=&gt;&nbsp;<span class="src-str">'SomeInfo'</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a22"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-comm">//&nbsp;send&nbsp;user&nbsp;to&nbsp;bank&nbsp;(Basicly&nbsp;outputs&nbsp;some&nbsp;html&nbsp;and&nbsp;calls&nbsp;die()&nbsp;)</span></div></li>
<li><div class="src-line"><a name="a23"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-id"><a href="../DomBase/BankPaymentHandler.html">BankPaymentHandler</a></span><span class="src-sym">::</span><a href="../DomBase/BankPaymentHandler.html#methodsendToBank">sendToBank</a><span class="src-sym">(&nbsp;</span><span class="src-var">$payment&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a24"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a25"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a26"></a><span class="src-comm">//&nbsp;handle&nbsp;replay&nbsp;(User&nbsp;comes&nbsp;back&nbsp;from&nbsp;bank)</span></div></li>
<li><div class="src-line"><a name="a27"></a><span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-key">if</span><span class="src-sym">(&nbsp;</span><span class="src-var">$_POST&nbsp;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a28"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-var">$replay&nbsp;</span>=&nbsp;<span class="src-id"><a href="../DomBase/BankPaymentHandler.html">BankPaymentHandler</a></span><span class="src-sym">::</span><a href="../DomBase/BankPaymentHandler.html#methodhandleReplay">handleReplay</a><span class="src-sym">(&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a29"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a30"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-key">if</span><span class="src-sym">(&nbsp;</span><span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">status&nbsp;</span>===&nbsp;<span class="src-num">1&nbsp;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a31"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;h3&gt;Successful&nbsp;payment&lt;/h3&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a32"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a33"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">elseif</span><span class="src-sym">(&nbsp;</span><span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">status&nbsp;</span>==&nbsp;<span class="src-num">2&nbsp;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a34"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;h3&gt;Payment&nbsp;already&nbsp;processed!&lt;/h3&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a35"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a36"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">elseif</span><span class="src-sym">(&nbsp;</span><span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">status&nbsp;</span>==&nbsp;<span class="src-num">3&nbsp;</span><span class="src-sym">)&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a37"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;h3&gt;User&nbsp;cancelled&nbsp;payment!&lt;/h3&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a38"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a39"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;</span><span class="src-key">else&nbsp;</span><span class="src-sym">{</span></div></li>
<li><div class="src-line"><a name="a40"></a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;h3&gt;Error:&nbsp;'</span>.<span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">statusStr</span>.<span class="src-str">'&lt;/h3&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a41"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-sym">}&nbsp;&nbsp;&nbsp;&nbsp;</span></div></li>
<li><div class="src-line"><a name="a42"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a43"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;b&gt;Payment&nbsp;info&lt;/b&gt;&lt;br&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a44"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;b&gt;Uid&lt;/b&gt;:&nbsp;'</span>.<span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">uid</span>.<span class="src-str">'&lt;br&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a45"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;b&gt;PaymentId&lt;/b&gt;:&nbsp;'</span>.<span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">logId</span>.<span class="src-str">'&lt;br&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a46"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;b&gt;Price&lt;/b&gt;:'</span>.<span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">price</span>.<span class="src-str">'&nbsp;'</span>.<span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">currency</span>.<span class="src-str">'&lt;br&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a47"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;b&gt;Bank&lt;/b&gt;:'</span>.<span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">bank</span>.<span class="src-str">'&lt;br&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a48"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;b&gt;Payment&nbsp;description&lt;/b&gt;:&nbsp;'</span>.<span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">description</span>.<span class="src-str">'&lt;br&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a49"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;b&gt;Added&nbsp;user&nbsp;data:&lt;/b&gt;&lt;br&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a50"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;pre&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a51"></a>&nbsp;&nbsp;&nbsp;&nbsp;<a href="http://www.php.net/print_r">print_r</a><span class="src-sym">(&nbsp;</span><span class="src-var">$replay</span><span class="src-sym">-&gt;</span><span class="src-id">userData&nbsp;</span><span class="src-sym">)</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a52"></a>&nbsp;&nbsp;&nbsp;&nbsp;echo&nbsp;<span class="src-str">'&lt;/pre&gt;'</span><span class="src-sym">;</span></div></li>
<li><div class="src-line"><a name="a53"></a>&nbsp;&nbsp;&nbsp;&nbsp;</div></li>
<li><div class="src-line"><a name="a54"></a><span class="src-sym">}</span></div></li>
<li><div class="src-line"><a name="a55"></a><span class="src-php">?&gt;</span></div></li>
<li><div class="src-line"><a name="a56"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a57"></a>&nbsp;</div></li>
<li><div class="src-line"><a name="a58"></a>&lt;form&nbsp;name=&quot;form&quot;&nbsp;action=&quot;&quot;&nbsp;method=&quot;post&quot;&gt;</div></li>
<li><div class="src-line"><a name="a59"></a>&nbsp;&nbsp;&nbsp;&nbsp;&lt;input&nbsp;type=&quot;text&quot;&nbsp;value=&quot;0.01&quot;&nbsp;name=&quot;price&quot;&gt;</div></li>
<li><div class="src-line"><a name="a60"></a>&nbsp;&nbsp;&nbsp;&nbsp;&lt;br&gt;</div></li>
<li><div class="src-line"><a name="a61"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-php">&lt;?php&nbsp;</span><span class="src-key">foreach</span><span class="src-sym">(&nbsp;</span><span class="src-id"><a href="../DomBase/BankPaymentHandler.html">BankPaymentHandler</a></span><span class="src-sym">::</span><a href="../DomBase/BankPaymentHandler.html#methodgetUsableBanks">getUsableBanks</a><span class="src-sym">(</span><span class="src-sym">)&nbsp;</span><span class="src-key">as&nbsp;</span><span class="src-var">$bank&nbsp;</span><span class="src-sym">)</span>:<span class="src-php">?&gt;</span></div></li>
<li><div class="src-line"><a name="a62"></a>&nbsp;&nbsp;&nbsp;&nbsp;&lt;img&nbsp;src=&quot;<span class="src-php">&lt;?php&nbsp;</span>echo&nbsp;<span class="src-var">$bank</span><span class="src-sym">[</span><span class="src-str">'icon'</span><span class="src-sym">]&nbsp;</span><span class="src-php">?&gt;</span>&quot;&nbsp;alt=&quot;<span class="src-php">&lt;?php&nbsp;</span>echo&nbsp;<span class="src-var">$bank</span><span class="src-sym">[</span><span class="src-str">'key'</span><span class="src-sym">]&nbsp;</span><span class="src-php">?&gt;</span>&quot;/&gt;</div></li>
<li><div class="src-line"><a name="a63"></a>&nbsp;&nbsp;&nbsp;&nbsp;&lt;input&nbsp;type=&quot;submit&quot;&nbsp;name=&quot;bank&quot;&nbsp;value=&quot;<span class="src-php">&lt;?php&nbsp;</span>echo&nbsp;<span class="src-var">$bank</span><span class="src-sym">[</span><span class="src-str">'key'</span><span class="src-sym">]&nbsp;</span><span class="src-php">?&gt;</span>&quot;&gt;&lt;br&gt;</div></li>
<li><div class="src-line"><a name="a64"></a>&nbsp;&nbsp;&nbsp;&nbsp;<span class="src-php">&lt;?php&nbsp;</span><span class="src-key">endforeach</span><span class="src-sym">;</span><span class="src-php">?&gt;</span></div></li>
<li><div class="src-line"><a name="a65"></a>&lt;/form&gt;</div></li>
</ol></div>
</div>
	<p class="notes" id="credit">
		Documentation generated on Fri, 24 Sep 2010 21:15:11 +0000 by <a href="http://www.phpdoc.org" target="_blank">phpDocumentor 1.4.1</a>
	</p>
	</body>
</html>